package com.wangyang.pojo;

import com.wangyang.anno.State;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import java.util.Date;

@Data
public class Article {
    private Integer id;
    @NotEmpty(groups = {Add.class, Update.class})
    @Pattern(regexp = "^\\S{1,10}$", groups = {Add.class, Update.class})
    private String title;
    @NotEmpty(groups = {Add.class, Update.class})
    private String content;
    @NotEmpty(groups = {Add.class, Update.class})
    @URL(groups = {Add.class, Update.class})
    private String coverImg;
    @NotEmpty(groups = {Add.class, Update.class})
    @State(groups = {Add.class, Update.class})
    private String state;
    @NotNull(groups = {Add.class, Update.class})
    private Integer categoryId;
    private Integer createUser;
    private Date createTime;
    private Date updateTime;

    public interface Add{}
    public interface Update{}
}
